package edu.java.lectures.lec12.threads.synchronization.estatic;

public class MyClass {

    private static int counter = 1;

    public static synchronized void setCounter(int counter) {
	MyClass.counter = counter;
	System.out.println("[MyClass] Counter updated: " + counter);
	// syncronized(this){
	// db.read();
	// //db.commit();
	// }
    }

    public static synchronized int getCounter() {
	synchronized (MyClass.class) {
	    System.out.println("[MyClass] Counter obtained: " + counter);
	    return counter;
	}
    }
}
